def func(l):
    # 将列表中的所有0移动到列表末尾并且不改变其它元素的相对位置
    i = 0
    while 0 in l:
        l.remove(0)
        i += 1

    for a in range(0, i):
        l.append(0)

    return l

l = [1, 2, 4, 3, 0, 7, 0, 4, 0, 0, 5, 3]
print(func(l))

# 方法2
def fun(l):
    for i in l:
        if i == 0:
            l.remove(i)
            l.append(i)

    return l


print(func(l))
print(fun(l))